#include <iostream>
#include "Serialization/DataStream.h"

#if 1

struct B : public Serializable
{
    std::string _name;
    int _age;
    int _sex;

    SERIALIZE(_name,_age,_sex)
};

class A : public Serializable
{
public:
    A(){}
    A(const std::string &name,int age,std::vector<B>data):_name(name),_age(age),_data(std::move(data)){}
    ~A(){}

    void show()
    {
        std::cout<<_name<<" "<<_age<<std::endl;
    }

    SERIALIZE(_name,_age,_data)
public:
    std::string _name;
    int _age;
    std::vector<B>_data;
};

#endif

int main() {
    DataStream ds;
    B b;
    b._name="wraww";
    b._age=19;
    b._sex=2;
    std::vector<B>v1;
    v1.push_back(b);
    A a("aads",18,v1);
    ds<<a;
    A a2;
    ds>>a2;
    std::cout<<a._name<<" "<<a._age<<"\n";
    for(auto iter = a2._data.begin();iter != a2._data.end();iter++)
    {
        std::cout<<iter->_name<<" "<<iter->_age<<" "<<iter->_sex<<"\n";
    }
    return 0;
}
